package com.example.flshtarvel.mapper;

import com.example.flshtarvel.entity.RouteLikeMap;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface RouteLikeMapMapper {
    //路线点赞
    @Insert("insert into route_like_map (route_id,user_id) values(#{routeId},#{userId})")
    public int routeLike(String routeId, String userId);

    //取消点赞
    @Delete("delete from route_like_map where route_id=#{routeId} and user_id=#{userId}")
    public int deleteRouteLike(String routeId,String userId);

    //查询点赞    根据路线id 用户id
    @Select("select * from route_like_map where route_id=#{routeId} and user_id=#{userId}")
    public List<RouteLikeMap> selectRouteLikeByRouteIdAndUserId(String routeId, String userId);

    //查询点赞数   根据路线id
    @Select("select count(*) from route_like_map where route_id=#{routeId}")
    public int selectRouteLikeByRouteId(String routeId);

}
